<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<script src="../js/vue.js"></script>
<style>
    .testanima-enter {
        opacity: 0;
    }

    .testanima-enter-active {
        animation: anima 5s;
    }

    .testanima-enter-to {
        opacity: 1;
    }

    /* 定义动画 */
    @keyframes anima {
        0% {
            transform: translateX(0px);
        }

        50% {
            transform: translateX(100px);
        }

        100% {
            transform: translateX(200px);
        }
    }
</style>

<body>
    <div id="app">
        <button @click="show=!show">切换</button>
        <!-- 过渡
        需求：显示时 没有 到有 transition  opacity 0-1
              隐藏时 有   到 没有    opacity 1 - 0 
        
        -->
        <!-- transition没有设置name时这六个属性为v-开头，如果有name,用name的值替换v -->
        <transition name="testanima">
            <!-- 是否显示模板 v-if  v-show -->
            <h1 v-show="show">显示隐藏切换</h1>
        </transition>
    </div>
    <script>
        const vm = new Vue({
            el: "#app",
            data: {
                show: true
            }
        })
    </script>
</body>

</html>